#!/bin/sh -e

CHPST="chpst -u postgres"
if ! $CHPST true 2> /dev/null; then
    CHPST=""
fi

exec 2>&1
exec $CHPST env -i PGAPPNAME="pgq ticker" /scripts/patroni_wait.sh --role primary -- /usr/bin/pgqd /home/postgres/pgq_ticker.ini
